<?php
/**
 * The template for displaying Archive pages.
 *
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * @package _s
 */

// 分类目录 1 为淘宝热卖分类目录，直接跳转至 sellinggoods.php 页面
if($cat == 1) {
	include(TEMPLATEPATH.'/sellinggoods.php');
	exit();
} 

get_header(); ?>

<div class="page_width">

	<div class="article_left">
		<div class="pagebox">
			<div class="navigate_path"><?php if (function_exists('wp_bac_breadcrumb')) {wp_bac_breadcrumb();}?></div>
			<div class="article_tags"><em>主题：</em>
				<?php
				$limit = get_option('posts_per_page');
				$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
				query_posts("cat=$cat&paged=$paged");
				if (have_posts()) : while (have_posts()) : the_post();
						$posttags = get_the_tags();
						if ($posttags) {
							foreach($posttags as $tag) {
								$all_tags[] = $tag->term_id;
							}
						}
					endwhile;
				endif; 
				
				wp_reset_query();
				if($all_tags){
					$tags_arr = array_unique($all_tags);
					$tags_str = implode(",", $tags_arr); 
					$args = array(
						'smallest'  => 12,
						'largest'   => 12,
						'unit'      => 'px',
						'number'    => 15,
						'orderby'   => '',
						'order'     => DESC,
						'format'    => 'flat',
						'include'   => $tags_str
					);
					wp_tag_cloud($args);
				}else{
					echo '该分类下暂无相关主题';
				}
				?>
			</div>
		</div>
		
		<div class="pagebox">
	        <ul>
	          <?php
	            //query_posts('&ignore_sticky_posts=1&cat='.$cat.'&paged='.$paged);
	            $postnun=1;
	            if(have_posts()):while(have_posts()):the_post();
	          ?>
	          <li class="articlelist">
	            <div class="thumbnail">
	              <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" target="_blank">
	                <?php
	                  $img_url = get_post_img();
	                  echo '<img src="'.$img_url.'" alt="'.$post->post_title.'" width="100" height="140" />'
	                  ?>
	              </a>
	            </div>
	            <div class="title">
	              <h1>
	                <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" target="_blank"><?php the_title(); ?>
	                </a>
	              </h1>
	              <?php if(is_sticky()){ ?>
	              <span>推荐</span>
	              <?php } ?>
	            </div>
	            <div class="info">
	            	<div style="display:inline-block">
		              <!--<div class="category"><?php the_category('') ?></div>
		              <div class="author"><?php the_author_posts_link(); ?></div>-->
		              <div class="date">
		                <?php the_time('Y-m-d') ?>
		              </div>
		              <div class="view">
		                <?php echo getPostViews(get_the_ID()); ?>
		              </div>
		              <div class="comment">
		                <?php comments_number('0','1','%');?>
		              </div>
	            	</div>
	            </div>
	            <div class="summary">
	              <?php the_excerpt(); ?>
	            </div>
	            <!--<div class="tag"><?php the_tags(); ?></div>-->
	          </li>
	          <?php $postnun++; endwhile; else: ?>
	          <li class="articlelist">
	            <div class="nothing">抱歉，暂无相关内容！</div>
	          </li>
	          <?php endif; ?>
	        </ul>
	        <div class="page">
	        	<?php posts_pagenavi(); ?>
	        </div>
	    </div>
	</div>
	<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>